Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

customerId is returned in Purchase API handler #83

Open
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

cb-gadagoju
Copy link
Contributor

Improvements :

  • customerId is not handled in Purchase API return handler, updated now handled the customerId for the Purchase API handler.
  • Cleared swift lint warning issues in few files.

…dled and also in view files cleared SwiftLint warning issues
@@ -12,7 +12,7 @@ public class CBPurchase: NSObject {
public static let shared = CBPurchase()
private var productIDs: [String] = []
public var receiveProductsHandler: ((_ result: Result<[CBProduct], CBPurchaseError>) -> Void)?
public var buyProductHandler: ((Result<(status:Bool, subscriptionId:String?, planId:String?), Error>) -> Void)?
public var buyProductHandler: ((Result<(status: Bool, subscriptionId: String?, planId: String?, customerId: String?), Error>) -> Void)?
Copy link
Contributor

@cb-haripriyan cb-haripriyan Aug 23, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would this be a breaking change. Is there anything we can do to reduce the impact?
Also would prefer this tuple be a type/alias instead.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would this be a breaking change. Is there anything we can do to reduce the impact? Also would prefer this tuple be a type/alias instead.

Updated with struct

@sonarcloud
Copy link

sonarcloud bot commented Aug 29, 2023

SonarCloud Quality Gate failed.    Quality Gate failed

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 0 Code Smells

No Coverage information No Coverage information
12.5% 12.5% Duplication

idea Catch issues before they fail your Quality Gate with our IDE extension sonarlint SonarLint

@@ -12,7 +12,7 @@ public class CBPurchase: NSObject {
public static let shared = CBPurchase()
private var productIDs: [String] = []
public var receiveProductsHandler: ((_ result: Result<[CBProduct], CBPurchaseError>) -> Void)?
public var buyProductHandler: ((Result<(status:Bool, subscriptionId:String?, planId:String?), Error>) -> Void)?
private var buyProductHandler: ((Result<PurchaseSubscription, Error>) -> Void)?
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should this be just Subscription?

@available(*, deprecated, message: "This will be removed in upcoming versions, Please use this API func purchaseProduct(product: CBProduct, customer : CBCustomer? = nil, completion)")
func purchaseProduct(product: CBProduct, customerId : String? = "",completion handler: @escaping ((_ result: Result<(status:Bool, subscriptionId:String?, planId:String?), Error>) -> Void)) {
func purchaseProduct(product: CBProduct, customerId: String? = "", completion handler: @escaping ((_ result: Result<PurchaseSubscription, Error>) -> Void)) {
buyProductHandler = handler
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We can remove this from the major version.

// MARK: - Subscription
public struct PurchaseSubscription: Decodable {
public let status: Bool
public let subscriptionDetails: CBValidateReceipt
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Any reason that we want to have subscriptionDetails here? IMO this struct is related to subscription and any details can be here itself. Check with NonSubscription

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants